<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css">
  <script src="https://cdn.bootcss.com/jquery/3.3.0/jquery.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
    crossorigin="anonymous"></script>
  <title>聊聊天</title>
  <style>
    .user {
      color: #00a1f4;
      cursor: pointer;
    }

    .content {
      display: inline-block;
      padding: 6px 10px;
      background-color: #00a1f4;
      border-radius: 8px;
      color: #fff;
    }

    .selfInfo {
      text-align: right;
    }

    .selfInfo2 {
      float: right;
    }
  </style>
</head>

<body>
  <div class="container" style="margin-top: 30px;">
    <div class="row">
      <div class="col-xs-12">
        <div class="panel panel-info">
          <div class="panel-heading">
            <h4 class="text-center">聊天室</h4>
            <div class="row">
              <div class="col-xs-6 text-center">
                <button id="joinRoomA" class="btn btn-primary">进入A战队</button>
                <button id="leaveRoomA" class="btn btn-primary" style="display: none;">离开A战队</button>
              </div>
              <div class="col-xs-6 text-center" style="display: none;">
                <button id="joinRoomB" class="btn btn-success">进入B战队</button>
                <button id="leaveRoomB" class="btn btn-success" style="display: none;">离开B战队</button>
              </div>
            </div>
          </div>
          <div class="panel-body">
            <ul id="list" class="list-group" style="height: 300px;overflow: auto;"></ul>
          </div>
          <div class="panel-footer">
            <div class="row">
              <div class="col-xs-10">
                <input type="text" class="form-control" id="input">
              </div>
              <div class="col-xs-1">
                <button class="btn btn-info" id="sendBtn">发送</button>
              </div>

              <!-- Modal -->
              <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                <div class="modal-dialog" role="document">
                  <div class="modal-content">
                    <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true" data-dismiss="modal">&times;</span>
                      </button>
                      <h4 class="modal-title" id="myModalLabel">请输入您的用户名</h4>
                    </div>
                    <div class="modal-body">
                      <div class="form-group">
                        <label for="username" class="control-label">用户名</label>
                        <input type="text" class="form-control" id="username" placeholder="请输入您的用户名">
                      </div>
                      </form>
                    </div>
                    <div class="modal-footer">
                      <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                      <button type="button" id="usernameConfirmBtn" class="btn btn-primary">确定</button>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <script src="/socket.io/socket.io.js"></script>
  <script src="./index2.js"></script>
</body>

</html>